package com.bzkj.web.controller.ncc;

import com.bzkj.basicinfo.domain.basic.vo.PrintNoOneCodeSkuInfoVo;
import com.bzkj.basicinfo.domain.basic.vo.PrintSkuInfoVo;
import com.bzkj.basicinfo.service.ncc.TableXXXSkuService;
import com.bzkj.common.annotation.LogC;
import com.bzkj.common.core.controller.BaseController;
import com.bzkj.common.core.domain.AjaxResult;
import com.bzkj.common.core.domain.R;
import com.bzkj.common.enums.BusinessType;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Date 2024/12/23 09:35:23
 * @description 动态表处理
 */
@RestController
@RequestMapping("tableXXXSku")
public class TableXXXSkuController extends BaseController
{
    @Autowired
    private TableXXXSkuService tableXXXSkuService;

//    /**
//     * 动态表添加数据
//     *
//     * @param entity
//     * @return
//     */
//    @PostMapping("insertTableXXXSkuData")
//    public AjaxResult insertTableXXXSkuData(@RequestBody TableXXXSku entity)
//    {
//        return tableXXXSkuService.insertTableXXXSkuData(entity);
//    }
//
//    /**
//     * 根据指定条件查询数据并生成二维码
//     *
//     * @param entity
//     * @return
//     */
//    @PostMapping("createQrCodeN")
//    public AjaxResult createQrCodeN(@RequestBody TableXXXSku entity)
//    {
//        startPage();
//        return tableXXXSkuService.createQrCodeN(entity);
//    }
//
    /**
     * 根据参数查询数据返回tree型结构
     *
     * @param
     * @return
     */
    @GetMapping("findTableXXXSkuList")
    @ApiOperation("查询库存状态下拉接口")
    public AjaxResult findTableXXXSkuList(@RequestParam String pkMarbasclass,  String pkBatchcode,String cwarehouseId,String cproductId)
    {
        return tableXXXSkuService.findTableXXXSkuList(pkMarbasclass, pkBatchcode,cwarehouseId,cproductId);
    }
    /**
     * 根据参数查询数据返回tree型结构
     *
     * @param
     * @return
     */
    @GetMapping("findPrintedSkuList")
    public AjaxResult findPrintedSkuList(@RequestParam("pkMarbasclass") String pkMarbasclass,  @RequestParam(value = "pkBatchcode",required = false) String pkBatchcode,@RequestParam("row") String row,@RequestParam("level") String level)
    {
        return tableXXXSkuService.findPrintedSkuInfo(pkMarbasclass, pkBatchcode,row,level);
    }


    /**
     * 打印数据
     * @param vo
     * @return
     */
    @PostMapping("printSkuInfo")
    public R printSkuInfo(@RequestBody PrintSkuInfoVo vo){
        return tableXXXSkuService.printSkuInfo(vo);
    }
    /**
     * 打印数据（补打）
     * @param vo
     * @return
     */
    @ApiOperation("补打接口")
    @PostMapping("repairPrintSkuInfo")
    @LogC(title = "标签",businessType = BusinessType.REPRINT,content = "'单据号：'+#vo.vbillcode+',补打容器号：'+#vo.sortNum")
    public AjaxResult repairPrintSkuInfo(@RequestBody PrintSkuInfoVo vo){
        return tableXXXSkuService.repairPrintSkuInfo(vo);
    }

    /**
     * 统计打印数据的总数、已打、未打数量
     * @param vo
     * @return
     */
    @PostMapping("countPrintInfo")
    public R countPrintInfo(@RequestBody PrintSkuInfoVo vo){
        return tableXXXSkuService.countPrintSkuInfo(vo);
    }


    /**
     * 批量打印非一物一码数据
     *
     * @param moreList
     * @return
     */
    @PostMapping("batchPrintNoOneCode")
    public R batchPrintNoOneCode(@RequestBody List<PrintNoOneCodeSkuInfoVo> moreList) {
        return tableXXXSkuService.batchPrintNoOneCode(moreList);
    }
}
